@echo off
::*********************************************
::**********************配置*******************
::*********************************************

::OFFSET
SET bootloader_offset=0
SET app_offset=0x2000
SET cfg_offset=0x82400

::*********************************************
::*********************生产********************
::*********************************************

::PATH
SET bootloader_path=..\\fireware\\bootloader.bin
SET app_path=..\\fireware\\application.bin


::检查依赖文件
echo Start Check File
if not exist %bootloader_path% goto booterr
if not exist %app_path% goto apperr


echo Merge Fireware
produce.exe STM32L1  %bootloader_path%  %app_path% %app_offset% %cfg_offset% || (goto mergerr)


::烧录
echo Start Burnning Fireware File
if not exist burn.jlink goto burnerr
jlink.exe burn.jlink
pause
exit 

::错误提示
:booterr
echo Not Find BootLoader File
pause
exit

:apperr
echo Not Find Application File
pause
exit

:burnerr
echo Not Find Burnning File
pause
exit

:mergerr
echo ############################################################
echo #                  Merge Fireware error                    #
echo ############################################################
pause
exit
